// 抽象
// 封装
// 继承
// 多态
class Person {
    name: string
    age: number

    constructor(name: string, age: number) {
        this.name = name
        this.age = age
    }

    eating() {
        console.log('eating');
    }
}

class Student extends Person {
    sno: number = 0

    constructor(name: string, age: number, sno: number) {
        super(name, age)
        this.sno = sno
    }

    studying() {
        console.log('studying');

    }
}

class Teacher extends Person {
    title: string = ''

    constructor(name: string, age: number, title: string) {
        super(name, age)
        this.title = title
    }
    eating(): void {
        // 先调用父类的方法
        super.eating()
        console.log('teacher eating');
    }
    teating() {
        console.log('teating');

    }
}

const stu = new Student('n1', 12, 34)
console.log(stu.age);
stu.studying()
stu.eating()

const t = new Teacher('t1', 1, '语文老师')
t.teating()
t.eating()

export { }